import {createRouter, createWebHashHistory} from 'vue-router'
import Home from '../views/Home.vue'
import Mainpage from '../pages/Mainpage.vue'


// 用户
import Login from '../pages/login/template.vue'
// import Login from '../pages/login/Login.vue'
import Register from '../pages/login/Register.vue'
import ForgetPassword from '../pages/login/ForgetPassword.vue'


import Demo from '../pages/login/demo.vue'


// 学生端
import StudentNavigation from '../pages/student/Navigation.vue'
import StudentMainpage from '../pages/student/Mainpage.vue'
import StudentSubmit from '../pages/student/SubmitHw.vue'
import StudentSubmitted from '../pages/student/homework/Submitted.vue'
import StudentUnSubmitted from '../pages/student/homework/UnSubmitted.vue'
import StudentContact from '../pages/student/contact/Contact.vue'
import StudentClassgradeManagement from '../pages/student/ClassgradeManagement.vue'
import StudentCgDetailedInfo from '../pages/student/components/ClassgradeDetailedInfo.vue'
import StudentChat from '../pages/student/Chat.vue'

// 教师端
import TeacherNavigation from '../pages/teacher/Navigation.vue'
import TeacherMainpage from '../pages/teacher/Mainpage.vue'
import TeacherClassManagement from '../pages/teacher/ClassManagement.vue'
import TeacherHomeworkCorrecting from '../pages/teacher/homework/HomeworkCorrecting.vue'
import TeacherHwOverlook from '../pages/teacher/homework/HwOverlook.vue'
import TeacherCgDetailedInfo from '../pages/teacher/components/ClassgradeDetailedInfo.vue'
import TeacherHwDetailedInfo from '../pages/teacher/components/HomeworkDetailedInfo.vue'
import TeacherPublishHw from '../pages/teacher/PublishHw.vue'
import TeacherStudentManagement from '../pages/teacher/components/StudentManagement.vue'
import TeacherTeacherManagement from '../pages/teacher/components/TeacherManagement.vue'
import TeacherChat from '../pages/teacher/Chat.vue'

//管理员端
import AdministractorNavigation from '../pages/administractor/Navigation.vue'
import AdministractorMainpage from '../pages/administractor/Mainpage.vue'
import AdministractorClassManagement from '../pages/administractor/ClassManagement.vue'
import AdministractorStudentManagement from '../pages/administractor/StudentManagement.vue'
import AdministractorTeacherManagement from '../pages/administractor/TeacherManagement.vue'
import AdministractorCreateClass from '../pages/administractor/components/CreateClass.vue'
import AdministractorCgDetailedInfo from '../pages/administractor/components/ClassgradeDetailedInfo.vue'
import AdministractorChat from '../pages/administractor/Chat.vue'




const routes = [
    {
        path: '/',
        name: 'Mainpage',
        component: Mainpage,
        children:[
            {
                path: '/login',
                name: 'Login',
                component: Login
            },
            {
                path: '/register',
                name: 'Register',
                component: Register
            },
            {
                path: '/forgetpassword',
                name: 'ForgetPassword',
                component: ForgetPassword
            },
            {
                path: '/demo',
                name: 'Demo',
                component: Demo
            }
        ]
    },
    {
        path: '/home',
        name: 'Home',
        component: Home
    },
    {
        path: '/student',
        name: 'Student',
        redirect: '/login',
        children: [
            {
                path: '/student/navigation',
                name: 'Navigation',
                component: StudentNavigation,
                children: [                    
                    {
                        path: '/student/mainpage',
                        name: 'StudentMainpage',
                        component: StudentMainpage
                    },
                    {
                        path: '/student/submit',
                        name: 'Submit',
                        component: StudentSubmit
                    },
                    {
                        path: '/student/submitted',
                        name: 'Submitted',
                        component: StudentSubmitted
                    },
                    {
                        path: '/student/unsubmitted',
                        name: 'UnSubmitted',
                        component: StudentUnSubmitted,
                        meta:{
                            title: "state"
                        }
                    },
                    {
                        path: '/student/contact',
                        name: 'Contact',
                        component: StudentContact
                    },
                    {
                        path: '/student/classmanagement',
                        name: 'StudentClassgradeManagement',
                        component: StudentClassgradeManagement
                    },
                    // 班级详细信息
                    {
                        path:'/student/cgdetailedinfo',
                        name: 'StudentCgDetailedInfo',
                        component: StudentCgDetailedInfo
                    },
                    // 聊天室
                    {
                        path:'/student/chat',
                        name: 'StudentChat',
                        component: StudentChat
                    },
                ]      
            }
        ]
    },

    // 教师端
    {
        path: '/teacher',
        name: 'Teacher',
        redirect: '/login',
        children: [
            {
                path: '/teacher/navigation',
                name: 'TeacherNavigation',
                component: TeacherNavigation,
                children:[
                    // 首页
                    {
                        path: '/teacher/mainpage',
                        name: 'TeacherMainpage',
                        component: TeacherMainpage
                    },
                    // 班级管理
                    {
                        path: '/teacher/classmanagement',
                        name: 'TeacherClassManagement',
                        component: TeacherClassManagement
                    },
                    // 作业总览
                    {
                        path: '/teacher/hwcorrecting',
                        name: 'TeacherHomeworkCorrecting',
                        component: TeacherHomeworkCorrecting
                    },
                    // 批改作业
                    {
                        path: '/teacher/hwoverlook',
                        name: 'TeacherHwOverlook',
                        component: TeacherHwOverlook
                    },
                    // 批改单个作业
                    {
                        path: '/teacher/hwcorrecting/:Hwid',
                        name: 'TeacherHomeworkCorrectingDetail',
                        component: () => import('../pages/teacher/homework/HwCorrectDetail.vue')
                    },
                    // 班级详细信息
                    {
                        path:'/teacher/cgdetailedinfo',
                        name: 'TeacherCgDetailedInfo',
                        component: TeacherCgDetailedInfo
                    },
                    // 作业详细信息
                    {
                        path:'/teacher/hwdetailedinfo',
                        name: 'TeacherHwDetailedInfo',
                        component: TeacherHwDetailedInfo
                    },
                    // 布置作业
                    {
                        path:'/teacher/publishhw',
                        name: 'TeacherPublishHw',
                        component: TeacherPublishHw
                    },
                    // 手动添加学生
                    {
                        path:'/teacher/studentmanagement',
                        name: 'TeacherStudentManagement',
                        component: TeacherStudentManagement
                    },
                    // 手动添加教师
                    {
                        path:'/teacher/teachermanagement',
                        name: 'TeacherTeacherManagement',
                        component: TeacherTeacherManagement
                    },
                    // 聊天室
                    {
                        path:'/teacher/chat',
                        name: 'TeacherChat',
                        component: TeacherChat
                    },
                ]
            }
        ]
    },
    // 管理员端
    {
        path: '/administractor',
        name: 'Administractor',
        redirect: '/login',
        children: [
            {
                path: '/administractor/navigation',
                name: 'AdministractorNavigation',
                component: AdministractorNavigation,
                children: [
                    // 首页
                    {
                        path: '/administractor/mainpage',
                        name: 'AdministractorMainpage',
                        component: AdministractorMainpage
                    },
                    // 班级管理
                    {
                        path: '/administractor/classmanagement',
                        name: 'ClassManagement',
                        component: AdministractorClassManagement
                    },
                    // 创建班级
                    {
                        path: '/administractor/createClass',
                        name: 'AdministractorCreateClass',
                        component: AdministractorCreateClass
                    },
                    // 学生管理
                    {
                        path: '/administractor/studentmanagement',
                        name: 'AdministractorStudentManagement',
                        component: AdministractorStudentManagement
                    },
                    // 教师管理
                    {
                        path: '/administractor/teachermanagement',
                        name: 'AdministractorTeacherManagement',
                        component: AdministractorTeacherManagement
                    },
                    // 班级详细信息
                    {
                        path:'/administractor/cgdetailedinfo',
                        name: 'AdministractorCgDetailedInfo',
                        component: AdministractorCgDetailedInfo
                    },
                    // 聊天室
                    {
                        path:'/administractor/chat',
                        name: 'AdministractorChat',
                        component: AdministractorChat
                    },
                ]
            }
        ]
    }
]

const router = createRouter({
    history: createWebHashHistory(),
    routes
})

export default router
